package com.gz.logistics.library.pojo;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 杜志娟 on 2016-04-27.
 */
public class ClothesName extends CustomerSpinnerObject{
    private int id;
    private String clothesname;
    private String price;
    private int deliveryday;//洗衣需要的时间

    public int getDeliveryday() {
        return deliveryday;
    }

    public void setDeliveryday(int deliveryday) {
        this.deliveryday = deliveryday;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getClothesname() {
        return clothesname;
    }

    public void setClothesname(String clothesname) {
        this.clothesname = clothesname;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }


    public String getProcessid() {
        return processid;
    }

    public void setProcessid(String processid) {
        this.processid = processid;
    }

    private String processid;
    @Override
    public String toString() {
        return clothesname;
    }
    public static List<ClothesName> parse(JSONArray jsonArray) throws JSONException {
        if (jsonArray == null || jsonArray.length() <= 0){
            return null;
        }
        List<ClothesName> clothesname= new ArrayList<ClothesName>();
        for (int i = 0 ; i < jsonArray.length() ; i ++ ){
            ClothesName info = new ClothesName();
            info.id = (jsonArray.getJSONObject(i)).getInt("id");
            info.clothesname = (jsonArray.getJSONObject(i)).getString("cloth_name");
            info.price = (jsonArray.getJSONObject(i)).getString("price");
            info.processid = (jsonArray.getJSONObject(i)).getString("process_id");
            info.deliveryday = (jsonArray.getJSONObject(i)).getInt("delivery_day");
            clothesname.add(info);
        }
        return clothesname;
    }
}
